import javafx.geometry.Pos;

/**
 * @User: vitobo
 * @Date: 2024-06-12
 * @Description:  顺序表学习
 *
 *
 */
public class TestList {
    public static void main(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.print();

        try{
            myArrayList.add(0,10);
        }catch (PosWrongfulException e){
            e.printStackTrace();
        }
        myArrayList.print();

        System.out.println("=======================");
        System.out.println(myArrayList.contains(10));
        System.out.println(myArrayList.contains(100));
        System.out.println(myArrayList.indexOf(10));
        System.out.println(myArrayList.indexOf(100));
        System.out.println("=======================");

        try{
            System.out.println(myArrayList.get(2));
        }catch(PosWrongfulException e){
            e.printStackTrace();
        }
        System.out.println("=======================");

        myArrayList.set(0,99);
        myArrayList.print();
        System.out.println("=======================");

        myArrayList.clear();
        myArrayList.print();

        myArrayList.add(999);
        myArrayList.print();

    }

}
